<!-- 
    Create Date  
    Author     
    Copyright(c) 2010 A.D.A Solution. All rights reserved
    ------------------------------------------------------------------------------
    Update History
    Ver.    TRB#              Date           Author       Note
    3.0     fix code review   2010/09/24     QuocBao      Fix code review V3.0
    3.0     TRB1              2010/09/24     QuocBao      fix bug 52 trong bugzilla
    
-->
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE></TITLE>
</HEAD>
<BODY>
<div class="subbody">
[var.generalTitle;htmlconv=no]
                 <hr align="center" size="1" color="#ff6600" width="100%">  
<table border="0" align="center" width="100%"   cellSpacing="0" cellpadding:="2">      
        
        <tr height="28" valign="middle">
            <td align="left">
                <table border= "0" cellSpacing="0" cellpadding:="2"  align="center">
                    <tr valign="top">
                        <td align="right"  style="width:150px"><b>Tên đăng nhập</b>&nbsp;</td>
                        <td align="left" colspan="2" style="white-space:nowrap;width:300px">
                            <input type="text" name="username" id="username" style="width:230px" class="input" readonly>
                            <span class="classidentify" >* </span>
                        </td>
                    </tr>
                    <tr valign="top">
                    <td align="right"  style="width:150px"><b>Họ tên/Công ty</b>&nbsp;</td>
                    <td align="left" colspan="2" style="white-space:nowrap;width:300px">
                    <input type="text" name="name" id="name" maxlength="64" style="width:230px" class="input"></td>
                    </tr>
                    <tr valign="top">
                        <td align="right"  style="width:150px"><b>Địa chỉ</b>&nbsp;</td>
                        <td align="left" colspan="2" style="white-space:nowrap;width:300px">
                            <input type="text" name="address" maxlength="255" id="address" style="width:230px" class="input">
                        </td>
                    </tr>
                    <tr valign="top">
                        <td align="right"  style="width:150px"><b>Số điện thoại</b>&nbsp;</td>
                        <td align="left" colspan="2" style="white-space:nowrap;width:300px">
                            <input type="text" name="phone" maxlength="32" id="phone" style="width:230px" class="input">
                        </td>
                    </tr>
                    <tr valign="top">
                        <td align="right"  style="width:150px"><b>ĐT di động</b>&nbsp;</td>
                        <td align="left" colspan="2" style="white-space:nowrap;width:300px">
                            <input type="text" name="mobi" maxlength="32" id="mobi" style="width:230px" class="input">
                        </td>
                    </tr>
                    <tr valign="top">
                        <td align="right"  style="width:150px"><b>Email</b>&nbsp;</td>
                        <td align="left" colspan="2" style="white-space:nowrap;width:300px">
                            <input type="text" name="email" id="email" maxlength="255" style="width:230px" class="input">
                            <span class="classidentify" >* </span>
                        </td>
                    </tr>
                    <tr valign="top">
                        <td align="right"  style="width:150px"><b>Số CMND</b>&nbsp;</td>
                        <td align="left" colspan="2" style="white-space:nowrap;width:300px">
                            <input type="text" name="identnumber" maxlength="32" id="identnumber" style="width:230px" class="input">
                        </td>
                    </tr>
                    <tr>
                    <td align="right">[onshow;block=tr;when [var.sGroup] = 1]
                        <label for="txtCapcha"><b>Thời gian timeout</b></label>
                    </td>
                    <td width="150">
                        <select id="cmbTimeOut"  name="cmbTimeOut" onchange="fn_TimeOut(this.value);" style="width:150px">

                            <option value="0">Không giới hạn</option>                            
                            <option value="2">Tùy chọn</option>
                        </select>
                    </td>
                    <td id="tdTimeOut">
                        <input type="text" id="txtTimeOut" name="txtTimeOut" value="30" maxlength="5" style="width:75px"/> <span id="spTimeOut">(phút) </span>                  
                    </td>                     
                </tr>
                 </table>
            </td>
        </tr>
        <tr height="30" valign="middle">
            <td align="center" >
                <button type="button" accesskey="C" onclick="fn_update_click();" class="button1" id="btnChange"><font color="red"><u>C</u></font>ập nhật</button>
                <button type="button" accesskey="N" onclick="fn_reset();" class="button1" id="btnReset">
                    <font color="red"><u>N</u></font>hập lại
                </button>
                [onshow;block=td;when [var.sCanEdit] = 1]
                <div align="center" id="spnLoading" style="display:none; position:fixed; width80%;">
                <img src="images/loader.gif" />
                <span style="color:red">Đang xử lý dữ liệu...</span></div>
            </td>
        </tr>
    </table>
    <input type="hidden" name="hidID" id="hidID" value="">
</div>
<script language="javascript" type="text/javascript">
   
    function fn_TimeOut(id)
    {
         if(id == 0)
         {
                $("#txtTimeOut").val("43200");
                $("#txtTimeOut").hide();
                $("#spTimeOut").hide();
                $('#txtTimeOut').attr('disabled',true);

         }else if(id == 2)
         {
               $("#txtTimeOut").show();
               $("#spTimeOut").show();
               $("#txtTimeOut").val("30");
               $('#txtTimeOut').attr('disabled',false);
               $("#txtTimeOut").focus(); 
         }
    }
    function fn_update_click()
    {
        var arrParams = new Array();  
        var username =  document.getElementById("username").value ;
        var name = document.getElementById("name").value ;
        var address = document.getElementById("address").value ;
        var phone = document.getElementById("phone").value ; 
        var mobi = document.getElementById("mobi").value ;
        var email = document.getElementById("email").value ;
                
        var identnumber = document.getElementById("identnumber").value ;  
        
        if(username=="")
        {
            alert(MSG_USERINFOR_NOT_INPUT_USERNAME);
            document.getElementById("username").focus() ;
            return;
        }
        if(email=="")
        {
            alert(MSG_USERINFOR_NOT_INPUT_EMAIL);
            document.getElementById("email").focus() ;
            return;
        }
        if(!validateEmail(email)) 
        {
            alert('Email không hợp lệ, vui lòng nhập lại!');
            document.getElementById("email").focus() ;
            return;
        }       
        //if(identnumber=="")
//        {
//            alert(MSG_USERINFOR_NOT_INPUT_SOCMND);
//            document.getElementById("identnumber").focus() ;
//            return;
//        }
        if([var.sGroup]==1){
            var timeout = document.getElementById("txtTimeOut").value ;
            if(!checknumber()){             
                return false;
            }
            arrParams["timeout"] = timeout ;
        }        
        arrParams["username"] = username ;
        arrParams["name"] = name ;
        arrParams["address"] = address ;
        arrParams["phone"] = phone ;
        arrParams["mobi"] = mobi ;
        arrParams["email"] = email ;
        arrParams["identnumber"] = identnumber;        
        //submit to server for save data to database
        $('#spnLoading').css('display', '');
        xajax_ajxUpdate(arrParams);
    }
    function fn_reset()
    {
        document.getElementById("name").value ="" ;
        document.getElementById("address").value ="";
        document.getElementById("phone").value="" ; 
        document.getElementById("mobi").value="" ;
        document.getElementById("email").value="" ;
        document.getElementById("identnumber").value="" ;  
        document.getElementById("name").focus() ;
    }
    function checknumber(){    
   var regInt   = /^\d{1,}$/;
   var txtTimeOut = $('#txtTimeOut').val();  
   var result ="";    
       if( (!regInt.test(txtTimeOut)) || (txtTimeOut <= 10) ){
            alert('Thời gian timeout phải là số nguyên dương và lớn hơn 10 phút.');
            $('txtTimeOut').focus();
            return false;
      }
      return true;      
}

</script>
<script  language="javascript" type="text/javascript">
   xajax_ajxFillData();   
   //$("#tdTimeOut").hide();
   $('#txtTimeOut').attr('disabled',true);
    
</script>
</BODY>
</HTML>
